{{template "header"}}

<title>登录-beego 博客</title>
</head>

<body>
<div style="height: 50px"></div>

<div class="container" style="width:500px">
    <form method="post" action="/login">
        <div class="input-group">
            <span class="input-group-addon" id="basic-addon1">@</span>
            <input type="text" id="username" class="form-control" placeholder="Username" aria-describedby="basic-addon1" name="username">
        </div>

        <div style="height: 30px"></div>

        <div class="input-group">
            <span class="input-group-addon" id="basic-addon1">* </span>
            <input type="text" id="password" class="form-control" placeholder="Password" aria-describedby="basic-addon1" name="password">
        </div>

        <div style="height: 20px"></div>

        <div class="checkbox">
            <label>
                <input type="checkbox" name="autoLogin"> remember login
            </label>
        </div>

        <button type="submit" class="btn btn-default" onclick="return checkinput()">Submit</button>
        <button class="btn btn-default" onclick="return backToHome()">BACK</button>
    </form>

    <script type="text/javascript">
        function checkinput() {
            var username = document.getElementById("username")
            if(username.value.length == 0){
                alert("请输入账号")
                return false
            }

            var password = document.getElementById("password")
            if(password.value.length == 0){
                alert("请输入密码")
                return false
            }

            return true
        }
        
        function backToHome() {
            window.location.href = "/";
            return false;
        }
    </script>
</div>

</body>

</html>